use crate::helpers::DatabaseConnection;
use anyhow::Result;
use std::ops::Deref;
use uuid::Uuid;
pub async fn get_userpost_id(event_id: String, db: &DatabaseConnection) -> Result<Option<Uuid>> {
    let rows = db
        .lock()
        .await
        .deref()
        .query(
            "SELECT userpost_id FROM messages WHERE event_id = $1",
            &[&event_id],
        )
        .await?;
    if let Some(row) = rows.get(0) {
        Ok(Some(row.get(0)))
    } else {
        Ok(None)
    }
}
